package com.neuedu.controller;

import com.neuedu.bean.DeliveryAddress;
import com.neuedu.common.R;
import com.neuedu.service.DeliveryAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

// 1. 将该类转换控制器类，并设置该中的方法返回值全部都是json数据
@RestController
//2.设置该模块的请求路径，如/user
@RequestMapping("/address")
//3.解决跨域
@CrossOrigin
public class DeliveryAddressController {
    @Autowired
    private DeliveryAddressService deliveryAddressService;
    @GetMapping("/listDeliveryAddressByUserId/{userId}")
    public R listDeliveryAddressByUserId(@PathVariable("userId") String userId) {
        List<DeliveryAddress> deliveryAddressList = deliveryAddressService.listDeliveryAddressByUserId(userId);
        return R.ok().data(deliveryAddressList);
    }
}
